import React, { Component } from 'react';
import { Switch, Route, Redirect } from 'react-router-dom'
class Routerview extends Component {
  render() {
    const {routes} = this.props
    return (
      <Switch>
        {
          routes.length > 0 && routes.map((v, i) => {
            return (
              v.path 
                ? <Route {...v} key={i}></Route>
                : <Redirect key={i} { ...v }></Redirect>
            )
          })
        }
      </Switch>
    );
  }
}

export default Routerview;
